//
//  Singleton.h
//  IM
//
//  Created by HZ on 14-8-13.
//  Copyright (c) 2014年 eternalworld. All rights reserved.
//

#ifndef Singleton_h
#define Singleton_h


// .h
#define singleton_interface(class)  + (class *)sharedInstance;

// .m
// \ 代表下一行也属于宏
// ## 是分隔符
#define singleton_implementation(class) \
static class *_instance; \
\
+ (class *)sharedInstance \
{ \
if (_instance == nil) { \
_instance = [[self alloc] init]; \
} \
return _instance; \
} \


#endif 
